import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

const login = r => require.ensure([], () => r(require('@/views_manage/Login')), 'login')
// manage部分
const manage = r => require.ensure([], () => r(require('@/views_manage/manage')), 'manage')
const home = r => require.ensure([], () => r(require('@/views_manage/home')), 'home')
const deviceList = r => require.ensure([], () => r(require('@/views_manage/deviceList')), 'deviceList')
const deviceName = r => require.ensure([], () => r(require('@/views_manage/deviceName')), 'deviceName')
const deviceType = r => require.ensure([], () => r(require('@/views_manage/deviceType')), 'deviceType')
const deviceStock = r => require.ensure([], () => r(require('@/views_manage/deviceStock')), 'deviceStock')
const deviceAllot = r => require.ensure([], () => r(require('@/views_manage/deviceAllot')), 'deviceAllot')
const deviceApply = r => require.ensure([], () => r(require('@/views_manage/deviceApply')), 'deviceApply')
// const simulationList = r => require.ensure([], () => r(require('@/views_manage/simulationList')), 'simulationList')
const taskList = r => require.ensure([], () => r(require('@/views_manage/taskList')), 'taskList')
const createTask = r => require.ensure([], () => r(require('@/views_manage/createTask')), 'createTask')
const taskAllotList = r => require.ensure([], () => r(require('@/views_manage/taskAllotList')), 'taskAllotList')
const reportList = r => require.ensure([], () => r(require('@/views_manage/reportList')), 'reportList')
const stepMonitor = r => require.ensure([], () => r(require('@/views_manage/stepMonitor')), 'stepMonitor')
const terminalList = r => require.ensure([], () => r(require('@/views_manage/terminalList')), 'terminalList')
const workstationList = r => require.ensure([], () => r(require('@/views_manage/workstationList')), 'workstationList')
const pcList = r => require.ensure([], () => r(require('@/views_manage/pcList')), 'pcList')
const manageMonitor = r => require.ensure([], () => r(require('@/views_manage/monitor')), 'manageMonitor')
const examList = r => require.ensure([], () => r(require('@/views_manage/examList')), 'examList')
const examAllotList = r => require.ensure([], () => r(require('@/views_manage/examAllotList')), 'examAllotList')
const examShow = r => require.ensure([], () => r(require('@/views_manage/examShow')), 'examShow')
const groupList = r => require.ensure([], () => r(require('@/views_manage/groupList')), 'groupList')
const userList = r => require.ensure([], () => r(require('@/views_manage/userList')), 'userList')
const loginRecord = r => require.ensure([], () => r(require('@/views_manage/loginRecord')), 'loginRecord')
const consumableList = r => require.ensure([], () => r(require('@/views_manage/consumableList')), 'consumableList')
const discussionManage = r => require.ensure([], () => r(require('@/views_manage/discussionManage')), 'discussionManage')

// const deviceList = r => require.ensure([], () => r(require('@/views_manage/deviceList')), 'deviceList')
// platform部分
const platform = r => require.ensure([], () => r(require('@/views_platform/platform')), 'platform')
const myCenter = r => require.ensure([], () => r(require('@/views_platform/myCenter')), 'myCenter')
const myTask = r => require.ensure([], () => r(require('@/views_platform/myTask')), 'myTask')
const myCourse = r => require.ensure([], () => r(require('@/views_platform/myCourse')), 'myCourse')
const myExam = r => require.ensure([], () => r(require('@/views_platform/myExam')), 'myExam')
const showExam = r => require.ensure([], () => r(require('@/views_platform/showExam')), 'showExam')
const history = r => require.ensure([], () => r(require('@/views_platform/history')), 'history')
const myMsg = r => require.ensure([], () => r(require('@/views_platform/myMsg')), 'myMsg')
const profile = r => require.ensure([], () => r(require('@/views_platform/profile')), 'profile')
const passwd = r => require.ensure([], () => r(require('@/views_platform/passwd')), 'passwd')
const learn = r => require.ensure([], () => r(require('@/views_platform/learn')), 'learn')
const explain = r => require.ensure([], () => r(require('@/views_platform/explain')), 'explain')
const textbook = r => require.ensure([], () => r(require('@/views_platform/textbook')), 'textbook')
const report = r => require.ensure([], () => r(require('@/views_platform/report')), 'report')
const platformMonitor = r => require.ensure([], () => r(require('@/views_platform/monitor')), 'platformMonitor')
const discussion = r => require.ensure([], () => r(require('@/views_platform/discussion')), 'discussion')
const discussionDetail = r => require.ensure([], () => r(require('@/views_platform/discussionDetail')), 'discussionDetail')
const consumptiveMaterial = r => require.ensure([], () => r(require('@/views_platform/consumptiveMaterial')), 'consumptiveMaterial')

// monitor部分
const monitor = r => require.ensure([], () => r(require('@/views_monitor/monitor')), 'monitor')
const mlogin = r => require.ensure([], () => r(require('@/views_monitor/login')), 'mlogin')
const mexplain = r => require.ensure([], () => r(require('@/views_monitor/explain')), 'mexplain')
const mtextbook = r => require.ensure([], () => r(require('@/views_monitor/textbook')), 'mtextbook')
const progress = r => require.ensure([], () => r(require('@/views_monitor/progress')), 'progress')

export default new Router({
  routes: [
    {
      path: '/',
      component: login
    },
    {
      path: '/manage',
      name: '管理后台',
      component: manage,
      children: [
        { path: 'home', component: home },
        { path: 'discussionManage', component: discussionManage, name: '讨论区' },
        { path: 'groupList', component: groupList, name: '班级列表' },
        { path: 'userList', component: userList, name: '用户列表' },
        { path: 'loginRecord', component: loginRecord, name: '刷卡记录' },
        { path: 'deviceType', component: deviceType, name: '设备类型' },
        { path: 'deviceName', component: deviceName, name: '设备名称' },
        { path: 'deviceStock', component: deviceStock, name: '设备库存' },
        { path: 'consumableList', component: consumableList, name: '设备库存' },
        { path: 'deviceList', component: deviceList, name: '设备列表' },
        { path: 'deviceApply', component: deviceApply, name: '设备更换列表' },
        { path: 'deviceAllot', component: deviceAllot, name: '配置下发' },
        // { path: 'simulationList', component: simulationList, name: '仿真列表' },
        // { path: 'simulationList', component: simulationList, name: '添加仿真' },
        { path: 'taskList', component: taskList, name: '任务列表' },
        { path: 'createTask', component: createTask, name: '新增任务' },
        { path: 'taskAllotList', component: taskAllotList, name: '下发列表' },
        { path: 'reportList', component: reportList, name: '报告列表' },
        { path: 'stepMonitor', component: stepMonitor, name: '步骤监控' },
        { path: 'terminalList', component: terminalList, name: '终端列表' },
        { path: 'workstationList', component: workstationList, name: '工位列表' },
        { path: 'pcList', component: pcList, name: 'pc列表' },
        { path: 'manageMonitor', component: manageMonitor, name: '管理端监控' },
        { path: 'examList', component: examList, name: '试卷列表' },
        { path: 'examAllotList', component: examAllotList, name: '试卷发布' },
        { path: 'examShow', component: examShow, name: '修改试卷' }
        // { path: '/', component: home, name: '工位详细' }
      ]
    },
    {
      path: '/platform/discussion',
      component: discussion
    },
    {
      path: '/platform/discussionDetail/:ask_id',
      component: discussionDetail
    },
    {
      path: '/platform',
      name: '实训平台',
      component: platform,
      children: [
        { path: 'myCenter', component: myCenter },
        { path: 'myTask', component: myTask, name: '我的任务' },
        { path: 'consumptiveMaterial', component: consumptiveMaterial, name: '耗材管理' },
        { path: 'learn',
          component: learn,
          name: '学习页面',
          children: [
            { path: 'explain', component: explain, name: '任务说明' },
            { path: 'textbook', component: textbook, name: '任务教程' },
            { path: 'monitor', component: platformMonitor, name: '平台监控' },
            { path: 'report', component: report, name: '实验报告' }
          ]},
        { path: 'myCourse', component: myCourse, name: '我的课程' },
        { path: 'myExam', component: myExam, name: '我的考试' },
        { path: 'showExam', component: showExam, name: '考卷详情' },
        { path: 'history', component: history, name: '学习足迹' },
        { path: 'myMsg', component: myMsg, name: '我的消息' },
        { path: 'profile', component: profile, name: '个人资料' },
        { path: 'passwd', component: passwd, name: '修改密码' }
      ]
    },
    {
      path: '/monitor/login',
      component: mlogin
    },
    {
      path: '/monitor',
      name: '监控系统',
      component: monitor,
      children: [
        { path: 'explain', component: mexplain, name: 'm任务说明' },
        { path: 'textbook', component: mtextbook, name: 'm任务教程' },
        { path: 'progress', component: progress, name: '任务进度' }
      ]
    }
  ]
})
